package cn.com.dcsgo.controller;

import cn.com.dcsgo.domain.dto.AfterSaleDTO;
import cn.com.dcsgo.domain.result.Result;
import cn.com.dcsgo.domain.vo.AfterSaleVO;
import cn.com.dcsgo.service.AfterSaleService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * AfterSaleServiceController
 *
 * @author Dcsgo
 * @since 16/5/2025 下午 4:59
 */
@CrossOrigin
@RestController
@RequestMapping("after-sale")
@RequiredArgsConstructor
public class AfterSaleController {
    private final AfterSaleService afterSaleService;

    @GetMapping("page/{page}/{size}")
    public Result<IPage<AfterSaleVO>> page(@PathVariable Integer page,
                                           @PathVariable Integer size,
                                           AfterSaleDTO afterSaleDTO) {
        Page<AfterSaleVO> pageParam = new Page<>(page, size);
        return Result.ok(afterSaleService.getPage(pageParam, afterSaleDTO));
    }
}
